import axiosInstance from '@/api/axiosInstance'
interface extraShareRuleListParams {
  name?: string
  // 其他查询条件...
}

// 获取附加推广销售分成规则列表
export const getExtraShareRuleList = async (params?: extraShareRuleListParams) => {
  return axiosInstance.get('/admin/extra-share-rule', { params })
}

// 获取附加推广销售分成规则详情
export const getExtraShareRuleDetail = async (id: number) => {
  return axiosInstance.get(`/admin/extra-share-rule/${id}`)
}
// 创建附加推广销售分成规则
export const createExtraShareRule = async (data: any) => {
  return axiosInstance.post('/admin/extra-share-rule', data)
}

// 更新附加推广销售分成规则
export const updateExtraShareRule = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/extra-share-rule/${id}`, data)
}

// 删除附加推广销售分成规则
export const deleteExtraShareRule = async (id: number) => {
  return axiosInstance.delete(`/admin/extra-share-rule/${id}`)
}

//创建规则项
export const createExtraShareRuleItem = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/extra-share-rule/${id}/item`, data)
}

//更新规则项
export const updateExtraShareRuleItem = async (id: number, itemId: number, data: any) => {
  return axiosInstance.put(`/admin/extra-share-rule/${id}/item/${itemId}`, data)
}

//删除规则项
export const deleteExtraShareRuleItem = async (id: number, itemId: number) => {
  return axiosInstance.delete(`/admin/extra-share-rule/${id}/item/${itemId}`)
}

// 设置适配该规则的医师
export const setExtraShareRuleDoctor = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/extra-share-rule/${id}/applicable-doctors`, data)
}
